Filter = new Class({
    initialize: function (WS, FC, BC, filer_containerId, grid_container){
        
        var YUI = YAHOO.util;
        new YAHOO.inputEx.Form({
                fields:FC
                ,parentEl: filer_containerId 
                ,buttons: BC
                ,onSubmit: function(e) {
                    YUI.Event.stopEvent(e); 

                    if (!this.validate()){
                        return;
                    }
                    data = this.getValue();
                    OnSubmit.run(data, this);
               }
        });
        function OnSubmit(data){
            WS.Process(
                data
                ,function(response){
                    call_back.run(response, this);
                }.bind(this)
                ,function(e){
                    call_back.run("<span>" + e + "</span><a href='"+ data.return_url +"' >Click to return</a>", this);
                }.bind(this));
        }
        function call_back(response){
            grid_container.set("html", response);
        }
    }
});